import { defineStore } from "pinia";
import { getApiList } from "../http";
import type {RootObject,Child,ChinaTotal,ChinaAdd,LocalCityNCOVDataList} from './type'


export const useStore = defineStore({
  id: "counter",
  state: () => ({
    list:<RootObject> {},
    item:<Child[]>[],
    chinaTotal:<ChinaTotal>{},
    chinaAdd:<ChinaAdd>{},
    cityDetail:<LocalCityNCOVDataList[]>[],
  }),

  actions: {
    async getList() {
      const res = await getApiList();
      console.log(res);
      this.list = res
      this.chinaAdd = res.diseaseh5Shelf.chinaAdd
      this.chinaTotal = res.diseaseh5Shelf.chinaTotal
      this.cityDetail = res.localCityNCOVDataList.slice(0,10)
      
    },
  },
});
